package com.qf.j2112.controller;

import com.qf.j2112.po.SysMembershopRecord;
import com.qf.j2112.vo.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.qf.j2112.service.SysMembershopRecordService;
import java.util.List;

/**
 * 会员消费记录Controller
 * @author j2112
 * @date 2022-04-12
 */

@RestController
public class SysMembershopRecordController {
    @Autowired
    private SysMembershopRecordService sysMembershopRecordService;

    /*查询会员消费记录列表*/
    @RequestMapping(value = "/shoplist",method = RequestMethod.GET)
    public AjaxResult listshop() {
        List<SysMembershopRecord> list = sysMembershopRecordService.selectSysMembershopRecordList();
        return AjaxResult.success("查询成功",list);
    }



    /*获取会员消费记录详细信息*/
    @RequestMapping(value = "/record/{recordMemberid}",method = RequestMethod.GET)
    public AjaxResult getshopInfo(@PathVariable("recordMemberid") Integer recordMemberid) {
        return AjaxResult.success(sysMembershopRecordService.selectSysMembershopRecordByRecordMemberid(recordMemberid));
    }

    /*新增会员消费记录*/
    @RequestMapping(value = "/addshop",method = RequestMethod.POST)
    public AjaxResult add(@RequestBody SysMembershopRecord sysMembershopRecord)
    {
        return AjaxResult.success(sysMembershopRecordService.insertSysMembershopRecord(sysMembershopRecord));
    }


}
